﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using MM.DBUtility;
using MM.Common;

namespace WebMMS.Manager
{
    public partial class NotificationBro : System.Web.UI.Page
    {
        private string strID = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    strID = Request.QueryString["ID"].ToStringOr();
                    if (!string.IsNullOrEmpty(strID))
                        BindData();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void BindData()
        {
            string strSQL = string.Format("SELECT * FROM T_NotificationUrl WHERE ID={0}", strID);
            DataSet ds = MM.DBUtility.DbHelperSql.Query(strSQL);
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                liTitle.Text = ds.Tables[0].Rows[0]["Title"].ToStringOr();
                imgInfo.ImageUrl = "~/Picture/" + ds.Tables[0].Rows[0]["Picture"].ToStringOr();
                hdfurl.Value = ds.Tables[0].Rows[0]["Url"].ToStringOr();
            }
        }

        protected void btnDownLoad_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(hdfurl.Value))
            {
                MM.Common.Common.PageRedirect(this.Page, hdfurl.Value);
            }

        }
    }
}